package com.allwees.bs.module.ums.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.allwees.bs.module.ums.entity.Device;
import com.allwees.core.dao.mybatis.dao.BaseDao;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

public interface DeviceDao extends BaseDao<Device> {

    @Select({"SELECT jpush_id FROM usr_device s WHERE s.user_uuid = #{userUuid}"})
    String getPushId(@Param("userUuid") String userUuid);

    default List<Device> findByUserUuids(Set<String> userUuids){
        LambdaQueryWrapper<Device> wrapper = new LambdaQueryWrapper<>();
        wrapper.in(Device::getUserUuid, userUuids);
        return selectList(wrapper);
    }
}
